﻿@using ChampionsLeagueBets.Domain
@using MvcContrib
@using MvcContrib.UI.Grid
@model IList<Tournament>

@Html.Grid(Model).RowAttributes(data => new Hash(@class => data.IsAlternate ? "row-normal" : "row-grayed")).Columns(column => 
        {
			column.For(cust => cust.Name);
			column.For(cust => cust.StartDate).Format("{0:dd-MM-yy}");
			column.For(cust => cust.EndDate).Format("{0:dd-MM-yy}");
			column.For(cust => cust.Money);
			column.For(cust => cust.Games != null ? cust.Games.Where(g => !g.IsDeleted).Count() : 0).Named("Liczba meczy");
			column.For(cust => Html.ActionLink<TournamentsController>(c => c.Edit(cust.Id), "Edytuj")).Named("Edycja");
			column.For(cust => Html.ActionLink<TournamentsController>(c => c.Delete(cust.Id), "Usuń", new { @class = "deleteLink" })).Named("Usuwanie"); 
        }
		).Empty("Brak turniejów")